home *** CD-ROM | disk | FTP | other *** search
/ Robotics & Artificial Int…3 (Professional Edition) / Robotics & Artificial Intelligence Tools 2003 (Professional Edition).iso / neural network tool and application / nsinstall.exe / data1.cab / DLLCust_Files / FILE / ASCII.C next >
Encoding:
C/C++ Source or Header  |  2002-03-08  |  1.1 KB  |  43 lines

  1. // Dynamic link library implementation of NeuroSolutions File component in ASCII mode
  2.  
  3. #include "NSDLL.h" 
  4. #include <stdio.h> 
  5.  
  6. /**********************************/
  7. /* Read next sample from file */
  8. __declspec(dllexport) BOOL performFile(
  9.     DLLData        *instance,    // Pointer to instance data (may be NULL)
  10.     FILE        *file,         // Pointer to the opened file
  11.     NSFloat        *sample        // Location to place next sample
  12.     )
  13. {
  14.     if (fscanf(file, "%f", sample) != EOF)
  15.         return TRUE;
  16.     fclose(file);
  17.     return FALSE;
  18. }
  19.  
  20. /********************************************/
  21. /* Open and the file and return its pointer */
  22. __declspec(dllexport) FILE *openFile(DLLData *instance, const char *filePath)
  23. {
  24.     return fopen(filePath, "r");
  25. }
  26.  
  27. /******************************************/
  28. /* Management of instance data (OPTIONAL) */
  29. /*
  30. __declspec(dllexport) DLLData *allocFile(
  31.     DLLData    *oldInstance    // Pointer to the last instance if reallocating
  32.     )
  33. {
  34.     DLLData *instance = NULL;
  35.     return instance;
  36. }
  37.  
  38. __declspec(dllexport) void freeFile(DLLData *instance)
  39. {
  40.     freeDLLInstance(instance);
  41. }
  42. */
  43.